









<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>scale4j - 
        configuration</title>
    <link rel="stylesheet" href="./css/maven-theme.css" type="text/css" />
    <link rel="stylesheet" href="./css/maven-base.css" type="text/css"/>
    <link rel="stylesheet" href="./css/prettify.css" type="text/css"/>
    <link rel="stylesheet" href="./css/print.css" type="text/css" media="print" />
    <script type="text/javascript" src="./js/prettify.js"></script>
    <script type="text/javascript" src="./js/niftycube.js"></script>
    <script type="text/javascript">
        window.onload=function() {
            Nifty("div\#wrapper", "big");
            Nifty("div#breadcrumbs", "small");
            Nifty("div\#navcolumn", "small");
            Nifty("div.source", "medium");
            prettyPrint();
        }
    </script>
        <meta name="Date-Revision-yyyymmdd" content="20110308" />
      </head>
  <body>
    <div id="wrapper">
        <div id="banner">
                        <div id="bannerLeft">
    
                                            <img src="./images/scale4j.png" alt="$alt" />
    
            </div>
                            <div class="clear">
            <hr/>
          </div>
        </div>
        <div id="breadcrumbs">
              
  

  
    
            
  
    
                  <div class="xright">      
  

  
    
            
  
    
             <span id="publishDate">Last Published: 2011-03-08</span>
              &nbsp;| <span id="projectVersion">Version: 0.1</span>
            </div>
          <div class="clear">
            <hr/>
          </div>
        </div>
        <div id="leftColumn">
          <div id="navcolumn">
               
  

  
    
            
  
    
                       <h5>Overview</h5>
            <ul>
              
    <li class="none">
                    <a href="index.html">Description</a>
          </li>
              
    <li class="none">
                    <a href="tutorials.html">Tutorials</a>
          </li>
              
    <li class="none">
              <strong>Configuration</strong>
        </li>
              
    <li class="none">
                    <a href="documentation.html">Documentation</a>
          </li>
          </ul>
              <h5>Project Documentation</h5>
            <ul>
              
                
                    
                  
                  
                  
                  
              
        <li class="collapsed">
                    <a href="project-info.html">Project Information</a>
                </li>
              
                
                    
                  
                  
                  
                  
              
        <li class="collapsed">
                    <a href="project-reports.html">Project Reports</a>
                </li>
          </ul>
              <h5>External links</h5>
            <ul>
              
    <li class="none">
                    <a href="http://hazelcast.com" class="externalLink">hazelcast</a>
          </li>
              
    <li class="none">
                    <a href="http://www.springsource.org" class="externalLink">spring</a>
          </li>
              
    <li class="none">
                    <a href="http://www.hibernate.org" class="externalLink">hibernate</a>
          </li>
              
    <li class="none">
                    <a href="http://static.springsource.org/spring-batch" class="externalLink">spring batch</a>
          </li>
              
    <li class="none">
                    <a href="http://static.springsource.org/spring-security/site/index.html" class="externalLink">spring security</a>
          </li>
              
    <li class="none">
                    <a href="http://www.jboss.org/envers" class="externalLink">hibernate envers</a>
          </li>
              
    <li class="none">
                    <a href="http://www.hibernate.org/subprojects/search.html" class="externalLink">hibernate search</a>
          </li>
              
    <li class="none">
                    <a href="http://www.quartz-scheduler.org/" class="externalLink">quartz</a>
          </li>
              
    <li class="none">
                    <a href="http://www.atomikos.com/Publications/WebHome" class="externalLink">atomikos</a>
          </li>
              
    <li class="none">
                    <a href="http://perf4j.codehaus.org" class="externalLink">perf4j</a>
          </li>
              
    <li class="none">
                    <a href="http://vaadin.com/home" class="externalLink">vaadin</a>
          </li>
          </ul>
                                               <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
            <img class="poweredBy"
                 alt="Built by Maven"
                 src="./images/logos/maven-feather.png"
                 width="90"
                 height="30"
                 border="1" />
          </a>
                           
  

  
    
            
  
    
            </div>
        </div>
        <div id="bodyColumn">
          <div id="contentBox">
            
    
        <div class="section"><h2>scale4j maven<a name="scale4j_maven"></a></h2>
            <p>
                Scale4j artifacts deployed to central repository - no need to add additional repositories.
                If you are not planning to use scale4j-agent then just add scale4j-rttp dependency.
                Also you can add scale4j-web - in this case you can omit scale4j-rttp dependency(the same for scale4j-agent).
            </p>
<div class="source"><pre>
    &lt;dependency&gt;
      &lt;groupId&gt;com.mykate-soft&lt;/groupId&gt;
      &lt;artifactId&gt;scale4j-rttp&lt;/artifactId&gt;
      &lt;version&gt;0.1&lt;/version&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;com.mykate-soft&lt;/groupId&gt;
      &lt;artifactId&gt;scale4j-agent&lt;/artifactId&gt;
      &lt;version&gt;0.1&lt;/version&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;com.mykate-soft&lt;/groupId&gt;
      &lt;artifactId&gt;scale4j-web&lt;/artifactId&gt;
      &lt;version&gt;0.1&lt;/version&gt;
    &lt;/dependency&gt;
</pre></div>
        </div>
        <div class="section"><h2>system variables<a name="system_variables"></a></h2>
            <p>
                There are few common properties defined in scale4j(default values). You can set each of them as system property.
            </p>

            <table border="0" class="bodyTable">
                <thead>
                    <tr class="a">
                        <td><b>property</b></td>
                        <td><b>description</b></td>
                        <td><b>default value</b></td>
                        <td><b>use from code</b></td>
                    </tr>
                </thead>
                <tbody>
                    <tr class="b">
                        <td>data_dir</td>
                        <td>basic directory where hibernate create/update schema script, log files, hibernate search indexes, transaction manager recovery to be stored</td>
                        <td>./data</td>
                        <td>RuntimeUtility.VAR_DATA_DIR</td>
                    </tr>
                    <tr class="a">
                        <td>runtime_mode</td>
                        <td>Enumeration JUNIT/DEV/TEST/UAT/PROD</td>
                        <td>NULL</td>
                        <td>RuntimeUtility.VAR_RUNTIME_MODE</td>
                    </tr>
                    <tr class="b">
                        <td>service_id</td>
                        <td>unique name of service(useful when you are using scale4j-agent)</td>
                        <td>NULL</td>
                        <td>RuntimeUtility.VAR_SERVICE_ID</td>
                    </tr>
                    <tr class="a">
                        <td>hazelcast_config</td>
                        <td>hazelcast configuration file location, visit <a class="externalLink" href="http://hazelcast.com/documentation.jsp#Config">hazelcast configuration</a> for more details</td>
                        <td>NULL</td>
                        <td>RuntimeUtility.VAR_HAZELCAST_CONFIGURATION</td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div class="section"><h2>log4j<a name="log4j"></a></h2>
            <p>
                There is nothing special to do with log4j. You would be able to set log4j configuration location using standard log4j.configuration system property.
                You may want to use <a href="./apidocs/com/katesoft/scale4j/log/LogDataDirAwareFileAppender.html">LogDataDirAwareFileAppender</a> class which allows to
                specify just location of file(target directory will be derived at runtime based on data_dir system property).
                Lets say we configured file=${service_id}-perfStats.log, as result target location in this case by default will be ./data/logs/${service_id}-perfStats.log.
                As you probably aware per4j is integrated into scale4j and care should be taken for configuring it according to your requirements.
                This is how it can be done <a class="externalLink" href="http://perf4j.codehaus.org/devguide.html#Using_the_log4j_Appenders_to_Generate_Real-Time_Performance_Information">Using log4j to Generate Real-Time Performance Information</a>.
                Nothing should prevent us from using system parameters, so it is recommended start using service_id system property from the beginning.
            </p>

<div class="source"><pre>
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&gt;
&lt;!DOCTYPE log4j:configuration SYSTEM &quot;log4j.dtd&quot;&gt;
&lt;log4j:configuration debug=&quot;false&quot; xmlns:log4j=&quot;http://jakarta.apache.org/log4j/&quot;&gt;
  &lt;appender name=&quot;fileAppender&quot; class=&quot;com.katesoft.scale4j.log.LogDataDirAwareFileAppender&quot;&gt;
    &lt;param name=&quot;File&quot; value=&quot;${service_id}-output.log&quot;/&gt;
    &lt;layout class=&quot;org.apache.log4j.PatternLayout&quot;&gt;
      &lt;param name=&quot;ConversionPattern&quot; value=&quot;%-5p [%t] %d{HH:mm:ss,SSS} %c{1} - %m%n&quot;/&gt;
    &lt;/layout&gt;
  &lt;/appender&gt;

  &lt;appender name=&quot;graphExecutionTimes&quot;
      class=&quot;com.katesoft.scale4j.log.ChartStatisticsAppender&quot;&gt;
    &lt;param name=&quot;GraphType&quot; value=&quot;Mean&quot;/&gt;
    &lt;appender-ref ref=&quot;graphsFileAppender&quot;/&gt;
  &lt;/appender&gt;

  &lt;appender name=&quot;graphExecutionTPS&quot; class=&quot;com.katesoft.scale4j.log.ChartStatisticsAppender&quot;&gt;
    &lt;param name=&quot;GraphType&quot; value=&quot;TPS&quot;/&gt;
    &lt;appender-ref ref=&quot;graphsFileAppender&quot;/&gt;
  &lt;/appender&gt;

  &lt;appender name=&quot;perf4jFileAppender&quot; class=&quot;com.katesoft.scale4j.log.LogDataDirAwareFileAppender&quot;&gt;
    &lt;param name=&quot;File&quot; value=&quot;${service_id}-perfStats.log&quot;/&gt;
    &lt;layout class=&quot;org.apache.log4j.PatternLayout&quot;&gt;
      &lt;param name=&quot;ConversionPattern&quot; value=&quot;%m%n&quot;/&gt;
    &lt;/layout&gt;
  &lt;/appender&gt;

  &lt;appender name=&quot;graphsFileAppender&quot; class=&quot;com.katesoft.scale4j.log.LogDataDirAwareFileAppender&quot;&gt;
    &lt;param name=&quot;File&quot; value=&quot;${service_id}-perfGraphs.log&quot;/&gt;
    &lt;layout class=&quot;org.apache.log4j.PatternLayout&quot;&gt;
      &lt;param name=&quot;ConversionPattern&quot; value=&quot;%m%n&quot;/&gt;
    &lt;/layout&gt;
  &lt;/appender&gt;

  &lt;appender name=&quot;CoalescingStatistics&quot; class=&quot;org.perf4j.log4j.AsyncCoalescingStatisticsAppender&quot;&gt;
    &lt;param name=&quot;TimeSlice&quot; value=&quot;10000&quot;/&gt;
    &lt;appender-ref ref=&quot;perf4jFileAppender&quot;/&gt;
    &lt;appender-ref ref=&quot;graphExecutionTimes&quot;/&gt;
    &lt;appender-ref ref=&quot;graphExecutionTPS&quot;/&gt;
  &lt;/appender&gt;

  &lt;logger name=&quot;org.perf4j.TimingLogger&quot; additivity=&quot;false&quot;&gt;
    &lt;appender-ref ref=&quot;CoalescingStatistics&quot;/&gt;
  &lt;/logger&gt;

  &lt;root&gt;
    &lt;level value=&quot;INFO&quot;/&gt;
    &lt;appender-ref ref=&quot;fileAppender&quot;/&gt;
  &lt;/root&gt;
&lt;/log4j:configuration&gt;</pre></div>
        </div>

        <div class="section"><h2>property placeholder configurer<a name="property_placeholder_configurer"></a></h2>
            <p>
                Configuring placeholder configurer in scale4j is actually the same as configuring application to use org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.
                But instead you will use <a href="./apidocs/com/katesoft/scale4j/common/spring/RuntimePropertyPlaceholderConfigurer.html">com.katesoft.scale4j.common.spring.RuntimePropertyPlaceholderConfigurer</a>,
                which is very simple extension with pre-defined order and ignoreUnresolvablePlaceholders properties.
                Example of usage
            </p>

<div class="source"><pre>
&lt;bean class=&quot;com.katesoft.scale4j.common.spring.RuntimePropertyPlaceholderConfigurer&quot;&gt;
    &lt;property name=&quot;locations&quot;&gt;
      &lt;list&gt;
        &lt;value&gt;classpath*:META-INF/resources/placeholder-${runtime_mode}.properties&lt;/value&gt;
      &lt;/list&gt;
    &lt;/property&gt;
  &lt;/bean&gt;
</pre></div>

            <p>
                So it is time to walk through all properties defined in application
            </p>

            <table border="0" class="bodyTable">
                <thead>
                    <tr class="a">
                        <td><b>property</b></td>
                        <td><b>default value</b></td>
                        <td><b>description</b></td>
                    </tr>
                </thead>
                <tbody>
                    <tr class="b">
                        <td>jdbc.driverClassName</td>
                        <td>org.h2.Driver</td>
                        <td>jdbc driver class, need to be changed and can be used only for junit testing</td>
                    </tr>
                    <tr class="a">
                        <td>jdbc.url</td>
                        <td>jdbc:h2:mem:scale4j;
                            MVCC=TRUE;DB_CLOSE_DELAY=-1</td>
                        <td>jdbc connection url, need to be changed and can be used only for junit testing</td>
                    </tr>
                    <tr class="b">
                        <td>jdbc.username</td>
                        <td>sa</td>
                        <td>jdbc connection user, need to be changed and can be used only for junit testing</td>
                    </tr>
                    <tr class="a">
                        <td>jdbc.password</td>
                        <td></td>
                        <td>jdbc connection password, need to be changed and can be used only for junit testing</td>
                    </tr>
                    <tr class="b">
                        <td>jdbc.initialSize</td>
                        <td>1</td>
                        <td>initial pool size</td>
                    </tr>
                    <tr class="a">
                        <td>jdbc.maxActive</td>
                        <td>100</td>
                        <td>maximum pool size</td>
                    </tr>
                    <tr class="b">
                        <td>hibernate.show_sql</td>
                        <td>false</td>
                        <td>show hibernate sql, can be changed for junit testing</td>
                    </tr>
                    <tr class="a">
                        <td>hibernate.format_sql</td>
                        <td>false</td>
                        <td>format hibernate statement</td>
                    </tr>
                    <tr class="b">
                        <td>hibernate.use_sql_comments</td>
                        <td>false</td>
                        <td>show comments for each hibernate query</td>
                    </tr>
                    <tr class="a">
                        <td>hibernate.generate_statistics</td>
                        <td>true</td>
                        <td>statistic gathered by default and exposed through JMX</td>
                    </tr>
                    <tr class="b">
                        <td>hibernate.dialect</td>
                        <td>org.hibernate.dialect.H2Dialect</td>
                        <td>hibernate dialect class, need to be changed and can be used only for junit testing</td>
                    </tr>
                    <tr class="a">
                        <td>hibernate.schema.update</td>
                        <td>true</td>
                        <td>perform schema update by default, mot likely you would like to write DDL changes by hand and disable this feature</td>
                    </tr>
                    <tr class="b">
                        <td>rttp.scheduler.db.create</td>
                        <td>true</td>
                        <td>if you are using quartz integration - let scale4j to create quartz schema for you</td>
                    </tr>
                    <tr class="a">
                        <td>rttp.batch.db.create</td>
                        <td>true</td>
                        <td>if you are using spring batch integration - let scale4j to create batch schema for you</td>
                    </tr>
                    <tr class="b">
                        <td>rttp.scheduler.parallel.db.create</td>
                        <td>true</td>
                        <td>if you are using quartz+batch integration - let scale4j to create quartz/batch schema in parallel</td>
                    </tr>
                    <tr class="a">
                        <td>rttp.store.table.meta.data</td>
                        <td>true</td>
                        <td>store meta-data information for all persistent entities in dedicated t_internal_entity table</td>
                    </tr>
                    <tr class="b">
                        <td>rttp.scheduler.auto.start</td>
                        <td>true</td>
                        <td>automatically start quartz job scheduler</td>
                    </tr>
                    <tr class="a">
                        <td>rttp.batch.tables.prefix</td>
                        <td>BATCH_</td>
                        <td>batch tables prefix</td>
                    </tr>
                    <tr class="b">
                        <td>rttp.quartz.tables.prefix</td>
                        <td>QRTZ_</td>
                        <td>quartz tables prefix</td>
                    </tr>
                    <tr class="a">
                        <td>rttp.quartz.scheduler.max.threads</td>
                        <td>25</td>
                        <td>quartz thread connection pool max size</td>
                    </tr>
                    <tr class="b">
                        <td>rttp.quartz.tables.prefix</td>
                        <td>QRTZ_</td>
                        <td>quartz tables prefix</td>
                    </tr>
                    <tr class="a">
                        <td>rttp.hibernate.generate.schema.creation.script</td>
                        <td>false</td>
                        <td>store schema creation script in dedicated sql file(file will be stored in ${data_dir}/hibernate/create folder)</td>
                    </tr>
                    <tr class="b">
                        <td>rttp.hibernate.generate.schema.delete.script</td>
                        <td>false</td>
                        <td>store schema drop script in dedicated sql file(file will be stored in ${data_dir}/hibernate/drop folder)</td>
                    </tr>
                    <tr class="a">
                        <td>rttp.hibernate.generate.schema.update.script</td>
                        <td>false</td>
                        <td>store schema update script in dedicated sql file(file will be stored in ${data_dir}/hibernate/update folder)</td>
                    </tr>
                    <tr class="b">
                        <td>web.app.admin.username</td>
                        <td>admin</td>
                        <td>if you are using scale4j-web, default admin user can be created with this login</td>
                    </tr>
                    <tr class="a">
                        <td>web.app.admin.password</td>
                        <td>admin</td>
                        <td>if you are using scale4j-web, default admin user can be created with this password</td>
                    </tr>
                </tbody>
            </table>
        </div>

        <div class="section"><h2>dependencies<a name="dependencies"></a></h2>
            <p>
                Versions that you would like to check before all other
            </p>
            <table border="0" class="bodyTable">
                <tbody>
                    <tr class="a">
                        <td>spring</td>
                        <td>3.0.5.RELEASE</td>
                    </tr>
                    <tr class="b">
                        <td>hibernate</td>
                        <td>3.6.1.Final</td>
                    </tr>
                    <tr class="a">
                        <td>hazelcast</td>
                        <td>1.9.2.1</td>
                    </tr>
                    <tr class="b">
                        <td>quartz</td>
                        <td>1.8.4</td>
                    </tr>
                    <tr class="a">
                        <td>spring batch</td>
                        <td>2.1.5.RELEASE</td>
                    </tr>
                    <tr class="b">
                        <td>hibernate envers</td>
                        <td>3.6.1.Final</td>
                    </tr>
                    <tr class="a">
                        <td>hibernate search</td>
                        <td>3.3.0.Final</td>
                    </tr>
                </tbody>
            </table>
        </div>
    

          </div>
        </div>
        <div class="clear">
          <hr/>
        </div>
        <div id="footer">
          <div class="xright">Copyright &#169;          
   
          2010-2011
    
                    <a href="http://mykate-soft.com">mykate-soft</a>.
            All Rights Reserved.    
  

  
    
            
  
    
  </div>
          <div class="clear">
            <hr/>
          </div>
        </div>
    </div>
  </body>
</html>
